import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect: '/home',
    },
    {
      path: '/login',
      component: () => import('@/views/login.vue'),
    },
    {
      path: '/layout',
      component: () => import('@/views/layout.vue'),
      children: [
        {
          name: 'home',
          path: '/home',
          component: () => import('@/views/二级导航/home.vue'),
        },
        {
          name: 'list',
          path: '/home/list',
          component: () => import('@/views/二级导航/list.vue'),
        },
        {
          name: 'news',
          path: '/home/news',
          component: () => import('@/views/二级导航/news.vue'),
        },
        {
          name: 'profile',
          path: '/home/profile',
          component: () => import('@/views/二级导航/profile.vue'),
        },
      ],
    },
    {
      name: 'map',
      path: '/map',
      component: () => import('@/views/map.vue'),
    },
    {
      name: 'city',
      path: '/city',
      component: () => import('@/views/city.vue'),
    },
    {
      name: 'detail',
      path: '/detail/:id',
      component: () => import('@/views/detail.vue'),
    },
    {
      name: 'registe',
      path: '/registe',
      component: () => import('@/views/registe.vue'),
    },
    {
      name: 'add',
      path: '/rent/add',
      component: () => import('@/views/rentadd.vue'),
    },
    {
      name: 'myrent',
      path: '/rent',
      component: () => import('@/views/myrent.vue'),
    },
    {
      name: 'favorate',
      path: '/favorate',
      component: () => import('@/views/favorate.vue'),
    },
    {
      name: 'nameSearch',
      path:'/nameSearch',
      component:() => import('@/views/NameSearch.vue')
    },
  ],
})

export default router
